package com.share.simpleFactory.calculator;

import java.util.Scanner;

public class Run {
    /**
     * 运行类
     * 题目：实现计算机控制台程序，要求传入两个数字和运算符，输出运算结果
     * @param args
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个数字");
        double num1 = scanner.nextDouble();
        System.out.println("请输入运算符(+, -, *, /)");
        String operator = scanner.next();
        System.out.println("请输入第二个数字");
        double num2 = scanner.nextDouble();
        Operation operation = OperationFactory.createOperation(operator);
        double result = operation.getResult(num1, num2);
        System.out.println("结果为" + result);
    }
}
